package editro.view.components {
	import com.greensock.TweenLite;
	import editro.model.AntTargetVO;
	import flash.display.Sprite;
	import flash.events.TextEvent;
	import ui.components.TaskDetailsPanel;

	/**
	 * ...
	 * 本类主要是处理一些显示的组件，由SWC导出，如按钮等资源
	 */
	public class ViewComponentsLayer extends Sprite {
		//fla asset
		private var taskPanel:TaskDetailsPanel = new TaskDetailsPanel;
		private var currentVO:AntTargetVO;
		private var displayWidth:int;
		private var displayHeight:int;
		
		private function updateMatchTaskVONameHandler(e:TextEvent):void {
			currentVO.targetName = taskPanel.title_tf.text;
		}
		
		public function showTaskVOInfo(vo:AntTargetVO):void {
			TweenLite.to(taskPanel, 0.3, {x:40} );
			currentVO = vo;
			taskPanel.title_tf.text = vo.targetName;
		}

		public function init(stageWidth:int, stageHeight:int):void {
			displayWidth = stageWidth;
			displayHeight = stageHeight;
			//
			addChild(taskPanel);
			taskPanel.x = displayWidth;
			//TODO:布局可能有点问题
			taskPanel.y = 100;
			taskPanel.title_tf.addEventListener(TextEvent.TEXT_INPUT, updateMatchTaskVONameHandler);
		}

	}

}